-
-
Notifications
You must be signed in to change notification settings - Fork 195
SA|ITP MAY 2025|INNOCENT NIWATWINE| Structuring and Data Testing| Sprint 3 #635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
SA|ITP MAY 2025|INNOCENT NIWATWINE| Structuring and Data Testing| Sprint 3 #635
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, you have written good solutions here, there are just a few questions I have for you to look at before this sprint is complete.
if (angle === 180) return "Straight angle"; | ||
if (angle > 180 && angle < 360) return "Reflex angle"; | ||
else if (angle > 180 && angle < 360) return "Reflex angle"; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need to have the same condition twice here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right i don't need to have the same condition twice because it is kind of duplication since the first condition already returns if that condition is true.I will proceed to remove ''else if'', thank you
} else if (numerator >= denominator) { | ||
return false; | ||
} else if (numerator === 1) { | ||
return true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this solution work for negative improper fractions, like -7/4?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could not because i found out what i did only checks numerator>=denominator and it didnt include the negative improper fractions ,i have tried to correct it, Thank you
@@ -1,5 +1,7 @@ | |||
function isProperFraction(numerator, denominator) { | |||
if (numerator < denominator) return true; | |||
// add your completed function from key-implement here | |||
if (numerator >= denominator) return false; | |||
// add your completed function from key-implement here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you are checking a condition which will give a true or false value, and you are then returning the same true or false value. Can you see a way to rewrite this that would simplify the function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What you've changed here doesn't really solve the problem with the fraction checking. Remember to make sure you run your tests when making changes, as well written tests will catch any problems.
The goal with the fraction checking is that
- When the numerator is smaller than the denominator (regardless of negatives) this is proper
- In any other case it is not proper
Can you think of a javascript function you could use to help you easily handle cases where there are negative numbers
No description provided.